<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="d" uri="/WEB-INF/resource.tld" %>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">
  
    <div class="panel panel-default x-panel x-panel-layout">
    
      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host }/user">用户管理</a></li>
          <li class="active">代言人</li>
        </ol>
      </div>
      
      <div class="panel-body">
      
        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>
        
        <div class="col-xs-10 x-panel-layout-right">
        
          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>代言人&nbsp;-&nbsp;代言人详情</span></h2>
            </div>
          </div>
          
          <div class="x-breadcrumb-wrapper ">
         
            <div class="x-breadcrumb-wrapper">
              <ul class="nav nav-pills x-breadcrumb-nav ajax-tab" data-content="#basic-content" data-operation="#agent-operation">
                <li class="pull-left active">
                   <a id="discount" href="${ctx.host}/agents/${agent.id}" data-toggle="tab" data-target="#agent-discount">折扣信息</a>
                </li>
                <li class="pull-left">
                  <a id="info" href="${ctx.host}/agents/${agent.id}/info" data-toggle="tab" data-target="#agent-info">基本信息</a>
                </li>       
                <li class="pull-left">
                  <a id="withdrawal" href="${ctx.host}/agents/${agent.id}/withdrawals" data-toggle="tab" data-target="#agent-withdrawal">提现信息</a>
                </li>  
              </ul>
              
              <div id="agent-operation" class="tab-operation pull-right">
                <div id="discount-operation" class="tab-operations hide">
                  <a href="${ctx.host}/agents/${agent.id}/agent-discounts/create" data-target="#discount-create" data-toggle="modal" title="增加">增加</a>
                </div>
              </div>
              
            </div>
            
            <div id="basic-content" class="tab-content ajax-tab-content">
              <div class="tab-pane fade active in" id="agent-discount" style="min-height: 100px;">
                <table class="table table-striped table-hover x-table" style="margin-bottom:20px;">
                  <thead>
                    <tr>
                      <th>折扣类型</th>
                      <th>优惠</th>
                      <th>推荐奖励</th>
                      <th>优惠券码</th>
                      <th class="text-center">操作</th>
                    </tr>
                  </thead>
                  <tbody>
                    <c:forEach var="agentDiscount" items="${agentDiscounts}">
                      <tr>
                        <td>${agentDiscount.discountType.description}</td>
                        <c:if test="${agentDiscount.discountType.discount}">
                          <td>${agentDiscount.agentDiscount}%</td>
                          <td>${agentDiscount.userDiscount}%</td>
                        </c:if>
                        <c:if test="${agentDiscount.discountType.payment}">
                          <td>${agentDiscount.discountOffer/100}</td>
                          <td>${agentDiscount.commission/100}</td>
                        </c:if>
                        <td>${agentDiscount.discountCode}</td>
                        <td class="text-center">
                          <a href="${ctx.host}/agents/${agent.id}/agent-discounts/${agentDiscount.id}/delete" title="删除" data-toggle="modal" data-target="#discount-delete" data-validate="required">删除</a>
                        </td>
                      </tr>
                    </c:forEach>
                  </tbody>
                </table>
              </div>
            </div>
            
           <div class="x-breadcrumb-wrapper">
             <ul class="nav nav-pills x-breadcrumb-nav ajax-tab" data-content="#order-content" data-operation="#order-operations">
                 <li class="pull-left">
                   <a id="order" href="${ctx.host}/agents/${agent.id}/order" data-toggle="tab" data-target="#agent-order">购买记录</a>
                 </li>
             </ul>
             
           </div>
           
           <div id="order-content" class="tab-content ajax-tab-content">
           </div>
           
         </div>
        </div>
      </div>
    </div>
  </div>

<%@ include file="/WEB-INF/include/script.jsp"%>
 <d:resource root="${ctx.resource}/build" type="script" src="js/page/user/agent-view.js">
    <script type="text/javascript">
      require(['page/user/agent-view'], function(page) {
        page.init()
      })
    </script>
  </d:resource>
  
</body>

</html>